package windows;


import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.WindowConstants;

import coordinators.Cordinator;

public class ManageClient extends JFrame 
{
	Cordinator coordinator;
	
	private static final long serialVersionUID = 1L;
	private ManageClientCreate 	manageClientCreate;
	private ManageClientModify 	manageClientModify;
	private ManageClientDelete 	manageClientDelete;
	private ManageClientShow 	manageClientShow;
	private JTabbedPane paneles;

	public ManageClient(WindowPrincipal superior)
	{
		super();
		setLayout(null);
		setSize(500,500);

		
		paneles=new JTabbedPane();

		paneles.setBounds(0,0,getWidth(),getHeight());

		manageClientCreate=new ManageClientCreate();
		manageClientCreate.setBounds(0,0,getWidth(),getHeight());
		manageClientCreate.setPreferredSize(manageClientCreate.getSize());

		manageClientModify =new ManageClientModify();
		manageClientModify .setBounds(0,0,getWidth(),getHeight());

		manageClientDelete=new ManageClientDelete();
		manageClientDelete.setBounds(0,0,getWidth(),getHeight());

		manageClientShow=new ManageClientShow();
		manageClientShow.setBounds(0,0,getWidth(),getHeight());

		paneles.addTab("Crear Cliente",manageClientCreate);
		paneles.addTab("Modificar Cliente", manageClientModify);
		paneles.addTab("Eliminar Cliente", manageClientDelete);
		paneles.addTab("Mostrar Cliente", manageClientShow);

		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		this.addWindowListener(new WindowListener() 
		{
	        public void windowClosed(WindowEvent arg0) 
	        {
	        	manageClientCreate.clean();
	        	manageClientModify.clean();
	            coordinator.ProcessCloseManageClient();
	        }
	        public void windowClosing(WindowEvent arg0) 
	        {
	        }
			public void windowActivated(WindowEvent e) 
			{
			}
			public void windowDeactivated(WindowEvent e) 
			{
			}
			public void windowDeiconified(WindowEvent e) 
			{
			}
			public void windowIconified(WindowEvent e) 
			{
			}
			public void windowOpened(WindowEvent e) 
			{
			}
		});
		add(paneles);
		setTitle("Gestionar Cliente");
		setLocation(250, 100);
		setResizable(false);
	}

	public void setCoordinador(Cordinator c)
	{
		coordinator = c;

	}
	
	public void Close()
	{
		setVisible(false);
	}
	
	
}
